<%= render "/shared/header" %>
<div class="mainbox">
  <div class="container container-fluid">
    <div class="row">
      <div id="movie">
        <div class='box'>
          <div class="share">

            <%= social_share_button_tag("#《#{@movie.title}》(#{@movie.year})  #{@movie.country_list}  ##{@movie.title}#", :rel => "twipsy", :label => "分享: ", :image => @movie.photo_url) %>
            <%= render "manage_button" %>
          </div>
          <div class='infos row'>
            <div class="cover col-xs-2">
              <%= image_tag(@movie.photo_url,:alt => @movie.title) %>
            </div>
            <h1><%= movie_title_tag_no_link(@movie, :allow_year => true) %></h1>
            <div class="sub_title">
              <% if @movie.type == 'tv' && @movie.episodes > 0 %>
              <span class="time_length">
               <%= @movie.episodes %> 集
              </span>-
              <% end %>
              <% if @movie.minutes > 0 %>
              <span class="time_length">
                <%= @movie.minutes %> min
              </span>-
              <% end %>
              <% if !@movie.countries.blank? %>
              <span class="countries"><%= movie_tags_tag(@movie, :countries) %></span>
              <% end %>
              <% if !@movie.categories.blank? %>
              <span class="categories"><%= movie_tags_tag(@movie, :categories) %></span>
              <% end %>
            </div>

            <div class="reviews">
              <span class="rank">
                <span class="vote-star"><i style="width:<%= @movie.average.round(1) * 10 %>%"></i></span>
                <span class="vote-number"> <%= @movie.average %> </span>
              </span>
              <div class="raters_count">
                <a href="http://movie.douban.com/subject/<%=@movie.source_id%>" rel="nofollow" target="_blank">豆瓣上有 <span itemprop="ratingCount"><%=@movie.ratings%></span> 人看过</a>
              </div>
            </div>

            <ul class="details col-xs-7">
              <% if !@movie.aliases.blank? %>
              <li>
                <b>又名:</b>
                <h2><%= @movie.aliases.join(" , ")%></h2>
              </li>
              <% end %>
              <% if !@movie.languages.blank? %>
              <li>
                <b>语言:</b>
                <span><%= movie_tags_tag(@movie, :languages) %></span>
              </li>
              <% end %>
              <% if !@movie.actors.blank? %>
              <li>
                <b>主演:</b>
                <span><%= movie_tags_tag(@movie, :actors) %></span>
              </li>
              <% end %>
              <% if !@movie.directors.blank? %>
              <li>
                <b>导演:</b>
                <span><%= movie_tags_tag(@movie, :directors) %></span>
              </li>
              <% end %>
              <% if !@movie.imdb.blank? %>
              <li>
                <b>IMDB:</b>
                <a href="http://www.imdb.com/title/<%=@movie.imdb%>/" target="_blank" rel="nofollow"><%=@movie.imdb%></a>
              </li>
              <% end %>
            </ul>

          </div>
        </div>


        <div class="summary box">
          <div class="content">
            <span itemprop="about">&nbsp;&nbsp;&nbsp;&nbsp;
              <% if @movie.summary.blank? %>...
              <% else %><%=@movie.summary%>
              <% end %>
            </span>
          </div>
        </div>
        <div id="downloads">
          <div class="attachs box">
            <div class="toolbar">
              <div style="text-align:right;">
                <a href="#subs" class="btn btn-mini btn-warning"><i class="fa fa-text-width"></i>字幕</a>
                <a href="#comments" class="btn btn-mini"><i class="fa fa-comment"></i>评论</a>
              </div>
            </div>

            <div class="content">
              <table class="table table-striped table-condensed">
                <thead>
                  <tr>
                    <th>品质</th>
                    <th>大小</th>
                    <th>下载地址</th>
                    <th class="opts"></th>
                  </tr>
                </thead>
                <% unless @movie.attaches.blank? %>
                <tbody>
                  <% @movie.attaches.each do |attach| %>
                  <tr id="attach_3">
                    <td class="qu">
                      <% if attach.quality > 1080 %>
                      超清
                      <% else %>
                      <%= attach.quality %>P
                      <% end %>
                    </td>
                    <td class="size"><span><%= number_to_human_size(attach.file_size) %></span>
                    </td>
                    <td class="name">
                      <%= link_to attach.name ,attach.url ,:class=>'attach' %>
                    </td>
                    <td class="opts">

                    </td>
                  </tr>
                  <% end %>
                </tbody>
                <% end %>
              </table>
            </div>
          </div>
          <div id="subs" class="box">
            <h2><%= @movie.title %>幕下载 <span class="sub">by 射手网 <a href="http://shooter.cn/search/<%= @movie.title %>/" rel="nofollow" target="_blank" class="btn btn-mini btn-success" style="margin-left:20px;"><i class="icon-search icon-white"></i>搜索更多字幕...</a></span></h2>
            <ul class="content">
            </ul>
	        <script type="text/javascript">
	        Movies.loadSubs("<%= @movie.title %>");
	        </script>
          </div>
        </div>


        <div class="box" id="relation">
          <h2>类似的电影</h2>
          <div class="box">
            <div class="row">
            	<%= render :partial => "/movies/recommand", :collection => @recommand %>
            </div>

          </div>
        </div>



      </div>

    </div>
  </div>
</div>

<%= render "/shared/footer" %>
